package cn.tedu.egmvc2.controller;

import cn.tedu.egmvc2.mapper.EmpMapper;
import cn.tedu.egmvc2.pojo.entity.Emp;
import cn.tedu.egmvc2.pojo.dto.EmpDTO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/emp/")
public class EmpController {
    @Autowired
    private EmpMapper empMapper;
@RequestMapping(value = "insert")
public String empInsert(EmpDTO empDTO){
    Emp emp=new Emp();
    BeanUtils.copyProperties(empDTO,emp);
    empMapper.insert(emp);
    return "添加成功";
}

}
